/**
 * 自定义样式
 * 用于覆盖VitePress默认样式和增强组件样式
 */

:root {
  --primary-color: #3c8772;
  --brand-color: #10b981;
  --text-color: #2c3e50;
  --border-color: #eaecef;
  --code-bg-color: #282c34;
  --header-height: 3.6rem;
  --vp-c-brand: #3eaf7c;
  --vp-c-brand-light: #4abf8a;
  --vp-c-brand-lighter: #6ccb9c;
  --vp-c-brand-dark: #369d6f;
  --vp-c-brand-darker: #2e8462;
  --vp-c-brand-dimm: rgba(62, 175, 124, 0.08);
  
  /* 高亮代码块颜色 */
  --prism-background: #1e1e1e;
  --prism-comment: #6a9955;
  --prism-string: #ce9178;
  --prism-literal: #569cd6;
  --prism-keyword: #569cd6;
  --prism-function: #dcdcaa;
  --prism-deleted: #ce9178;
  --prism-class: #4ec9b0;
  --prism-builtin: #4ec9b0;
  --prism-property: #9cdcfe;
  --prism-namespace: #4ec9b0;
  --prism-punctuation: #d4d4d4;
  --prism-decorator: #bd8f8f;
  --prism-operator: #d4d4d4;
  --prism-number: #b5cea8;
  --prism-boolean: #569cd6;
  --prism-variable: #9cdcfe;
  --prism-constant: #4fc1ff;
  --prism-symbol: #f8c555;
  --prism-interpolation: #9cdcfe;
  --prism-selector: #d7ba7d;
  --prism-attr-name: #9cdcfe;
  --prism-attr-value: #ce9178;
  --prism-entity: #4ec9b0;
  --prism-code-block: #1e1e1e;
}

/* 深色模式下的样式 */
.dark {
  --vp-c-bg: #1a1a1a;
  --vp-c-bg-alt: #242424;
  --vp-c-bg-soft: #2c2c2c;
}

/* 修正表格显示 */
.vp-doc table {
  display: table;
  width: 100%;
  overflow-x: auto;
}

.vp-doc tr {
  border-top: 1px solid var(--border-color);
  transition: background-color 0.3s;
}

.vp-doc th, .vp-doc td {
  border: 1px solid var(--border-color);
  padding: 0.6em 1em;
}

.vp-doc tr:nth-child(2n) {
  background-color: rgba(0, 0, 0, 0.02);
}

/* 代码复制按钮 */
.copy-btn {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.2s;
}

pre:hover .copy-btn {
  opacity: 1;
}

/* 表格容器 */
.table-container {
  margin: 1rem 0;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

/* 类型卡片 */
.type-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.type-card {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 16px;
  transition: all 0.3s;
  background-color: var(--vp-c-bg-soft);
}

.type-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  border-color: var(--brand-color);
}

.type-card h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.type-card .file-name {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 12px;
}

.type-card .actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* 加载动画 */
.loading-spinner {
  display: inline-block;
  width: 50px;
  height: 50px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--brand-color);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 错误提示 */
.error-message {
  border-left: 4px solid #e53935;
  background-color: rgba(229, 57, 53, 0.1);
  padding: 16px;
  margin: 16px 0;
  border-radius: 0 4px 4px 0;
}

/* 文件内容容器 */
.file-content {
  position: relative;
  padding: 16px;
  background-color: var(--vp-code-block-bg);
  border-radius: 6px;
  margin: 16px 0;
  overflow-x: auto;
}

/* 修改后的文件标记 */
.modified-file {
  position: relative;
  border-left: 4px solid #e6a23c;
}

.modified-file::before {
  content: '已修改';
  position: absolute;
  top: 0;
  right: 0;
  padding: 2px 8px;
  font-size: 12px;
  background-color: #e6a23c;
  color: white;
  border-radius: 0 0 0 4px;
}

/* 自动生成标签 */
.auto-generated {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  background-color: #67c23a;
  color: white;
  border-radius: 4px;
  margin-left: 8px;
}

/* 表格选项卡 */
.table-tabs {
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

/* 搜索区域 */
.search-area {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}

.search-input {
  flex: 1;
}

.search-actions {
  display: flex;
  gap: 8px;
}

/* 监控状态指示器 */
.monitor-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.monitor-active {
  animation: blink 2s infinite;
}

@keyframes blink {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* 高亮最近修改的文件 */
.recently-modified {
  background-color: rgba(230, 162, 60, 0.1);
  border-left: 3px solid #e6a23c;
  animation: highlight 3s;
}

@keyframes highlight {
  from { background-color: rgba(230, 162, 60, 0.3); }
  to { background-color: rgba(230, 162, 60, 0.1); }
}

/* 文件树容器 */
.file-tree-container {
  max-height: 400px;
  overflow-y: auto;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .table-responsive {
    overflow-x: auto;
  }
  
  .el-table {
    width: 100%;
    min-width: 650px;
  }
}

/* 代码复制按钮样式 */
.code-copy-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

/* 类型卡片 */
.type-card {
  transition: all 0.3s;
  cursor: pointer;
}

.type-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 加载中动画 */
.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  z-index: 9999;
}

/* 添加自定义样式 */
.file-content-container {
  position: relative;
  padding: 15px;
  margin-bottom: 20px;
  background-color: #f5f7f9;
  border-radius: 6px;
  border-left: 5px solid var(--el-color-primary);
}

.refresh-button {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 10;
}

/* 高亮显示被修改的文件 */
.file-modified {
  animation: highlight 2s ease-in-out;
}

@keyframes highlight {
  0% { background-color: rgba(255, 255, 0, 0.2); }
  100% { background-color: transparent; }
}

/* 自动生成的表格信息标签 */
.auto-generated-tag {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  height: 24px;
  font-size: 12px;
  line-height: 24px;
  border-radius: 4px;
  background-color: var(--el-color-primary-light-9);
  color: var(--el-color-primary);
  margin-left: 10px;
}

/* 监听状态指示器 */
.monitor-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 15px;
  background-color: #f0f9eb;
  color: #67c23a;
}

.monitor-status.offline {
  background-color: #fef0f0;
  color: #f56c6c;
}

.monitor-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
  animation: blink 1.5s infinite;
}

@keyframes blink {
  0% { opacity: 0.2; }
  50% { opacity: 1; }
  100% { opacity: 0.2; }
}

.file-tree-container {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  margin-bottom: 20px;
}

/* 复制按钮增强样式 */
.copy-button-wrapper {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: none;
}

pre:hover .copy-button-wrapper {
  display: block;
}

/* 表格样式增强 */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  overflow-x: auto;
  font-size: 0.9rem;
}

table th {
  background-color: var(--vp-c-bg-soft);
  font-weight: 600;
  text-align: left;
}

table th,
table td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--vp-c-divider);
}

table tbody tr:nth-child(odd) {
  background-color: var(--vp-c-bg-alt);
}

/* 响应式布局调整 */
@media (max-width: 768px) {
  .type-viewer,
  .table-viewer {
    flex-direction: column;
    height: auto;
  }
  
  .type-picker,
  .table-picker {
    width: 100%;
    height: 300px;
    border-right: none;
    border-bottom: 1px solid var(--vp-c-divider);
  }
}

/* Prism.js 语法高亮增强 */
code[class*="language-"],
pre[class*="language-"] {
  font-family: 'Fira Code', Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.5;
  tab-size: 2;
  -webkit-hyphens: none;
  hyphens: none;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: var(--prism-comment);
}

.token.punctuation {
  color: var(--prism-punctuation);
}

.token.namespace {
  color: var(--prism-namespace);
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol {
  color: var(--prism-property);
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin {
  color: var(--prism-string);
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  color: var(--prism-operator);
}

.token.atrule,
.token.attr-value,
.token.keyword {
  color: var(--prism-keyword);
}

.token.function,
.token.class-name {
  color: var(--prism-function);
}

.token.regex,
.token.important,
.token.variable {
  color: var(--prism-variable);
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background-color: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--vp-c-divider);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--vp-c-text-3);
} 